<template>

<h1>访问模板引用</h1>
<button id="btn" ref="btn">按钮</button>

<h2>访问echarts</h2>
<div ref="main" style="width: 600px;height: 400px;"></div>
</template>
<script>
import * as echarts from 'echarts';
export default {
    mounted(){
        const btn = this.$refs.btn;
        console.log(btn.offsetWidth,btn.offsetHeight);
        
        const mychart = echarts.init(this.$refs.main);
        mychart.setOption({
            title: {
                text: 'ECharts 入门示例'
            },
            tooltip: {},
            legend: {
                data:['衬衫','羊毛衫','羊毛衫','雪纺衫','裤子','高跟鞋','袜子']
            },
            xAxis: {
            },
            yAxis: {},
            series: [{
                name: '销量',
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20]
            }]
        });
    },
    
    
}

</script>